import React, { Component } from 'react';
import { HashRouter,Switch,Route} from 'react-router-dom';
//同步加载所有组件
import Home from './page/index';
import User from './page/user';
import Detail from './page/detail';
/*import asyncComponent from './async-component'

// 异步加载组件
const Home = asyncComponent(() => import('./page/index'))
const User = asyncComponent(() => import('./page/user'))
const Detail = asyncComponent(() => import('./page/detail'))*/

class App extends Component {
  render() {
    return (
      <HashRouter>
        <Switch>
            <Route exact path={'/'} component={Home} />
            <Route path={'/user/:id'} component={User} />
            <Route path={'/detail'} component={Detail} />

        </Switch>
      </HashRouter>     
    );
  }
}
export default App;
